<?php
/**
 * @version		$Id: default_categories.php 772 2012-04-17 19:21:09Z jeffchannell $
 * @package		JCalPro
 * @subpackage	com_jcalpro

**********************************************
JCal Pro
Copyright (c) 2006-2012 Anything-Digital.com
**********************************************
JCalPro is a native Joomla! calendar component for Joomla!

JCal Pro was once a fork of the existing Extcalendar component for Joomla!
(com_extcal_0_9_2_RC4.zip from mamboguru.com).
Extcal (http://sourceforge.net/projects/extcal) was renamed
and adapted to become a Mambo/Joomla! component by
Matthew Friedman, and further modified by David McKinnis
(mamboguru.com) to repair some security holes.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This header must not be removed. Additional contributions/changes
may be added to this header as long as no information is deleted.
**********************************************
Get the latest version of JCal Pro at:
http://anything-digital.com/
**********************************************

 */

defined('JPATH_PLATFORM') or die;
$db = &JFactory::getDBO();
$query = 'select * from #__menu where menutype="categories" and published=1 order by id';
$db->setQuery( $query );
$menuitem = $db->loadObjectList();

?>
<script src="http://code.jquery.com/jquery-latest.js"></script>

<style type="text/css">
	.cat_Checkbox, #save_value{
		float:left;
	}
</style>
<div class="jcal_categories">
	<h3><?php echo JText::_('COM_JCALPRO_CATEGORIES'); ?></h3>
    <form name="formcategoriesfilter" id="formcategoriesfilter" action="index.php" method="POST">
	<?php for ($i=0; $i<count($this->categories); $i++) : ?>
    <?php //for ($i=0; $i<count($menuitem); $i++) : ?>
	<div class="jcal_category">
		<!--<div class="jcal_category_color" style="background-color: <?php echo $this->categories[$i]->params->get('jcalpro_color'); ?>">&nbsp;</div>
		<div class="jcal_category_title">
            <a href="<?php echo JCalProHelperFilter::escape(JCalProHelperUrl::category($this->categories[$i]->id)); ?>">
                <?php echo JCalProHelperFilter::escape($this->categories[$i]->title); ?>
            </a>
        </div>-->
        <div class="jcal_category_color" style="background-color: <?php echo $menuitem[$i]->note; ?>">&nbsp;&nbsp;</div>
        <input type="checkbox" name="catcalendar" class="cat_Checkbox" value="<?php echo $menuitem[$i]->id; ?>">
        <div class="jcal_category_title">
            <a href="index.php?option=com_jcalpro&view=events&layout=month&Itemid=<?php echo $menuitem[$i]->id; ?>">
                <?php echo JCalProHelperFilter::escape($menuitem[$i]->title); ?>
            </a>
        </div>
	</div>
	<?php endfor; ?>
    	<input type="button" id="save_value" name="save_value" value="Filter" />
    </form>
	<div class="jcl_clear"><!--  --></div>
</div>

<script type="text/javascript">
	$('#save_value').click(function($final){
		var final = '';
		$('.cat_Checkbox:checked').each(function(){        
			var values = $(this).val();
			final += values;
			final += ' ';
		});
		alert( final );
	});
</script>